package com.ssy.lingxi.purchase.api.enums.tender;

import com.ssy.lingxi.common.language.LanguageHolder;

import java.util.Arrays;

/**
 * 招标内部状态枚举类型
 * @author jw.chen
 * @version 2.0.0
 * @date 2020/6/29
 */
public enum InviteTenderInStatusEnum {

    Not_Submitted_Check_Invite_Tender(1, "待提交审核招标"),
    Not_Tender_Check(2, "待审核招标(一级)"),
    Tender_Check_Not_Pass(3, "招标审核不通过(一级)"),
    Not_Tender_Check_2(4, "待审核招标(二级)"),
    Tender_Check_Not_Pass_2(5, "招标审核不通过(二级)"),
    Tender_Check_Pass(6, "待提交招标"),
    Submitted_Invite_Tender(7, "已提交招标"),
    Not_Register_Check(8, "待审核报名"),
    Not_Qualifications_Check(9, "待审核资格预审"),
    Not_Selection_Tender(10, "待评标"),
    Submitted_Selection_Tender(11, "待提交评标报告"),
    Not_Submitted_Check_Finish_Tender(12, "待提交审核定标"),
    Not_Check_Finish_Tender(13, "待审核定标(一级)"),
    Finish_Tender_Check_Not_Pass(14, "定标审核不通过(一级)"),
    Not_Check_Finish_Tender_2(15, "待审核定标(二级)"),
    Finish_Tender_Check_Not_Pass_2(16, "定标审核不通过(二级)"),
    Not_Confirm_Finish_Tender(17, "待确认定标"),
    Not_Win_Notice(18, "待中标公示"),
    Finish_Invite_Tender(19, "完成招标"),
    Discard_Tender(20, "已废标");

    private Integer code;
    private String message;

    InviteTenderInStatusEnum(Integer code, String message) {
        this.code = code;
        this.message = message;
    }

    public Integer getCode() {
        return code;
    }

    public String getMessage() {
        return LanguageHolder.getName(this.getClass(), this.code);
    }

    public static String getMessage(Integer code){
        InviteTenderInStatusEnum statusEnum = Arrays.stream(InviteTenderInStatusEnum.values()).filter(v -> v.getCode().equals(code)).findAny().orElse(null);
        return null == statusEnum ? "" : LanguageHolder.getName(InviteTenderInStatusEnum.class, statusEnum.getCode());
    }
}
